package cn.monkey.transport.netty.duplex;

import cn.monkey.transport.core.Inbound;
import cn.monkey.transport.netty.NettyOutbound;
import io.netty.channel.Channel;
import reactor.core.publisher.Flux;

import java.util.function.Predicate;

/**
 * 将mqInbound中读取到的数据转发到nettyOutbound中
 */
public interface DuplexOutbound extends NettyOutbound, Inbound {

    NettyOutbound nettyOutbound();

    Inbound inbound();

    @Override
    default <T> Flux<T> receive(Class<T> clazz, Predicate<T> p) {
        return this.inbound().receive(clazz, p);
    }

    @Override
    default Channel channel() {
        return this.nettyOutbound().channel();
    }
}
